package com.example.easybuy.service.impl;

import com.example.easybuy.entity.PType;
import com.example.easybuy.mappers.TypeMapper;
import com.example.easybuy.service.TypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service

public class TypeServiceImpl implements TypeService {
    @Autowired
    private TypeMapper typeMapper;


    @Override
    public List<PType> getList(Map<String, Object> map) {
        return typeMapper.getList(map);
    }

    @Override
    public PageInfo<PType> selectMySon(Map<String,Object> map) {
        map.put("orderBy","id1 asc");
        PageHelper.startPage(map);
        List<PType> list=typeMapper.selectMySon(map);
        return new PageInfo<>(list);
    }

    @Override
    public boolean doUpdate(Map<String, Object> map) {
        return typeMapper.doUpdate(map)>0;
    }

    @Override
    public boolean doDel(Map<String, Object> map) {
        return typeMapper.doDel(map)>0;
    }

    @Override
    public boolean doAdd(Map<String, Object> map) {
        return typeMapper.doAdd(map)>0;
    }

    @Override
    public PType getCategory(Map<String, Object> map) {
        return typeMapper.getCategory(map);
    }

    @Override
    public PType getParent(Map<String, Object> map) {
        return typeMapper.getParent(map);
    }

    @Override
    public boolean findSon(Map<String, Object> map) {
        return typeMapper.findSon(map)>0;
    }

    @Override
    public boolean findProduct(Map<String, Object> map) {
        return typeMapper.findProduct(map)>0;
    }

}
